import { createRouter, createWebHistory } from 'vue-router';
import HelloWorld from "@/views/HelloWorld.vue";
import UserIndex from "@/views/user/UserIndex.vue";
import UserCenter from "@/views/obsolete/UserCenter.vue";
import UserMessage from "@/views/obsolete/UserMessage.vue";
import UserRoomManage from "@/views/user/UserRoomManage.vue";
import UserHistory from "@/views/user/UserHistory.vue";
import EmployeeIndex from "@/views/obsolete/EmployeeIndex.vue";
import EmployeeRoomStatus from "@/views/employee/EmployeeRoomStatus.vue";
import EmployeeProcess from "@/views/employee/EmployeeProcess.vue";
import EmployeeHistory from "@/views/employee/EmployeeHistory.vue";
import AdminIndex from "@/views/obsolete/AdminIndex.vue";
import AdminNewUser from "@/views/obsolete/AdminNewUser.vue";
import AdminEditUser from "@/views/admin/AdminEditUser.vue";
import AdminNewEmployee from "@/views/obsolete/AdminNewEmployee.vue";
import AdminEditEmployee from "@/views/admin/AdminEditEmployee.vue";
import AdminNewRoom from "@/views/obsolete/AdminNewRoom.vue";
import AdminEditRoom from "@/views/admin/AdminEditRoom.vue";
import AdminHistory from "@/views/admin/AdminHistory.vue";
import NotFound from "@/views/NotFound.vue";
import UserContainer from "@/components/user/UserContainer.vue";
import EmployeeContainer from "@/components/employee/EmployeeContainer.vue";
import AdminContainer from "@/components/admin/AdminContainer.vue";
import EmployeeLogin from "@/views/employee/EmployeeLogin.vue";
import AdminLogin from "@/views/admin/AdminLogin.vue";

// 配置路由
const routes = [
    {
        // 匹配根路径
        path: '/',
        component: HelloWorld
    },
    {
        // 用户界面
        path: '/user',
        component: UserContainer,
        redirect: '/user/index',
        children:
        [
            {
                // 用户首页
                path: 'index',
                component: UserIndex,
                meta: { userAuth: false }
            },
            /*{
                // 用户个人中心页面
                path: 'center',
                component: UserCenter,
                meta: { userAuth: false }
            },
            {
                // 用户个人信息页面
                path: 'center/usermessage',
                component: UserMessage,
                meta: { userAuth: true }
            },*/
            {
                // 用户客房管理页面
                path: 'center/roommessage/roommanage',
                component: UserRoomManage,
                meta: { userAuth: true }
            },
            {
                // 用户入住历史页面
                path: 'center/history',
                component: UserHistory,
                meta: { userAuth: true }
            }
        ]
    },
    {
        // 员工登录页面
        path: '/employee/index',
        component: EmployeeLogin,
        meta: { employeeAuth: false }
    },
    {
        path: '/employee',
        component: EmployeeContainer,
        redirect: '/employee/index',
        children: [
            /*{
                // 员工首页
                path: 'index',
                component: EmployeeIndex,
                meta: { employeeAuth: false }
            },*/
            {
                // 员工客房状态页面
                path: 'roomstatus',
                component: EmployeeRoomStatus,
                meta: { employeeAuth: true }
            },
            {
                // 员工退房处理页面
                path: 'process',
                component: EmployeeProcess,
                meta: { employeeAuth: true }
            },
            {
                // 员工历史订单页面
                path: 'history',
                component: EmployeeHistory,
                meta: { employeeAuth: true }
            }
        ]
    },
    {
        // 管理员登录页面
        path: '/admin/index',
        component: AdminLogin,
        meta: { adminAuth: false }
    },
    {
        path: '/admin',
        component: AdminContainer,
        redirect: '/admin/index',
        children: [
            /*{
                // 管理员首页
                path: 'index',
                component: AdminIndex,
                meta: { adminAuth: false }
            },
            {
                // 管理员新建用户页面
                path: 'usermanage/newuser',
                component: AdminNewUser,
                meta: { adminAuth: true }
            },*/
            {
                // 管理员用户信息修改页面
                path: 'usermanage/edituser',
                component: AdminEditUser,
                meta: { adminAuth: true }
            },
            /*{
                // 管理员新建员工页面
                path: 'employeemanage/newemployee',
                component: AdminNewEmployee,
                meta: { adminAuth: true }
            },*/
            {
                // 管理员员工信息修改页面
                path: 'employeemanage/editemployee',
                component: AdminEditEmployee,
                meta: { adminAuth: true }
            },
            /*{
                // 管理员添加客房页面
                path: 'roommanage/newroom',
                component: AdminNewRoom,
                meta: { adminAuth: true }
            },*/
            {
                // 管理员客房信息修改页面
                path: 'roommanage/editroom',
                component: AdminEditRoom,
                meta: { adminAuth: true }
            },
            {
                // 管理员订单管理页面
                path: 'history',
                component: AdminHistory,
                meta: { adminAuth: true }
            }
        ]
    },
    {
        // 404
        path: '/:pathMatch(.*)*',
        component: NotFound
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

export default router;